package com.liuugoqing.behavioral.order;

import java.util.Set;

/**
 * 实现命令
 * 具体命令（Concrete  Command）角色：具体的命令，实现命令接口；通常会持
 * 有接收者，并调用接收者的功能来完成命令要执行的操作
 * @Author : liugq
 * @Date : 2022/7/6 17:18
 * @See : 参考类
 * @Since： JDK1.8
 * @Version : 1.0
 */
public class OrderCommand implements Command {
    private SeniorChef seniorChef;
    private Order order;

    public OrderCommand(SeniorChef seniorChef, Order order) {
        this.seniorChef = seniorChef;
        this.order = order;
    }

    @Override
    public void execute() {
        System.out.println(order.getDiningTable() + "桌的订单：");
        Set<String> keys = order.getFoodDic().keySet();
        for (String key : keys) {
            seniorChef.makeFood(key,order.getFoodDic().get(key));
        }
        System.out.println(order.getDiningTable() + "桌的饭弄好了");
    }
}
